<template>
  <el-row style="text-align:left">
    <el-form :model="formData" label-width="100px">
      <el-form-item label="角色">
        <el-input v-model="formData.name"></el-input>
      </el-form-item>
      <el-form-item label="描述">
        <el-input v-model="formData.description"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="handleSave" type="primary">保存</el-button>
      </el-form-item>
    </el-form>
  </el-row>
</template>

<script>
  export default {
    name: 'Role',
    props: ['formData'],
    methods: {
      handleSave: function() {
        this.$api.saveRole(this.formData).then(res =>{
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          this.$emit('success')
        })
      }
    }
  }
</script>

<style>

</style>
